import {createRouter, createWebHistory} from 'vue-router'
import AppLayout from "@/components/layout/AppLayout.vue";

const router = createRouter({
    history: createWebHistory(),
    routes: [
        {
            path: '/',
            redirect: '/home'
        },
        {
            path: '/home',
            name: 'home',
            component: AppLayout,
            meta: {
                title: "首页",
            },
            children: [
                {
                    path: '',
                    name: 'Home',
                    component: () => import("@/views/home/home.vue")
                },

                {
                    path: "/users",
                    name: "users",
                    component: () => import("@/views/users/UsersView.vue"),
                    meta: {
                        title: "用户管理",
                    },
                },
                {
                    path: "/course",
                    name: "course",
                    component: () => import("@/views/course/CourseManage.vue"),
                    meta: {
                        title: "课程管理",
                    },
                },
                {
                    path: "/messages/list",
                    name: "list",
                    component: () => import("@/views/message/MessageList.vue"),
                    meta: {
                        title: "消息管理-消息列表",
                    },
                },
                {
                    path: "/messages/system",
                    name: "system",
                    component: () => import("@/views/message/MessageSystem.vue"),
                    meta: {
                        title: "消息管理-系统消息",
                    },
                },
                {
                    path: "/permission/role",
                    name: "role",
                    component: () => import("@/views/permission/RoleList.vue"),
                    meta: {
                        title: "权限管理-角色列表",
                    },
                },
                {
                    path: "/permission/menu",
                    name: "menu",
                    component: () => import("@/views/permission/MenuList.vue"),
                    meta: {
                        title: "权限管理-菜单列表",
                    },
                },
                {
                    path: "/menu/edit/:id",
                    name: "editMenu",
                    component: () => import("@/views/permission/CreateOrEdit.vue"),
                    meta: {
                        title: "权限管理-菜单列表-编辑菜单",
                    },
                },
                {
                    path: "/menu/create",
                    name: "createMenu",
                    component: () => import("@/views/permission/CreateOrEdit.vue"),
                    meta: {
                        title: "权限管理-菜单列表-创建菜单",
                    },
                },
                {
                    path: "/permission/resource",
                    name: "resourceu",
                    component: () => import("@/views/permission/ResourceList.vue"),
                    meta: {
                        title: "权限管理-资源列表",
                    },
                },
                {
                    path: "/settings/base",
                    name: "base",
                    component: () => import("@/views/system/SettingBase.vue"),
                    meta: {
                        title: "系统设置-基本设置",
                    },
                },
                {
                    path: "/settings/log",
                    name: "log",
                    component: () => import("@/views/system/SettingLog.vue"),
                    meta: {
                        title: "系统设置-日志管理",
                    },
                },
            ]
        },
        {
            path: '/login',
            name: 'Login',
            component: () => import("@/views/login/LoginIndex.vue")
        },
        {
            path: '/register',
            name: 'Register',
        }
    ]
})

export default router